//
//  SalaryDAO.m
//  CoreDataDemo
//
//  Created by chenguibang on 16/2/29.
//  Copyright © 2016年 chenguibang. All rights reserved.
//

#import "SalaryDAO.h"
#import "Salary+CoreDataProperties.h"
#import "Salary.h"
@implementation SalaryDAO
-(BOOL)insert:(SalaryModel *)model{
    
    NSManagedObjectContext *cxt = [self managedObjectContext];
    Salary *insertmodel =(Salary*)[NSEntityDescription insertNewObjectForEntityForName:@"Salary" inManagedObjectContext:cxt];
    insertmodel.sy_level = model.sy_level;
    insertmodel.sy_scale  = model.sy_scale;
    NSError *error = nil;
    if ([self.managedObjectContext save:&error]) {
        NSLog(@"数据插入成功");
        return YES;
    }else{
        NSLog(@"数据插入失败");
        return NO;
    }
    return NO;
    
}
@end
